package app.srong.service;

import app.srong.mapper.PracticeMapper;
import app.srong.mapper.PracticeTopicMapper;
import app.srong.vo.PracticeTopic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class PracticeTopicService {

    @Autowired
    PracticeTopicMapper practiceTopicMapper;

    @Autowired
    PracticeMapper practiceMapper;


    public void insert(PracticeTopic practiceTopic) {
        practiceTopicMapper.insert(practiceTopic);
    }

    public PracticeTopic endSubTopic(Integer usbTopicId) {
        practiceMapper.selectListByParentId(usbTopicId);
        return null;

    }

    @Transactional
    public String clearData() {

        Integer clearData = practiceMapper.clearData();
        Integer integer = practiceTopicMapper.clearData();

        return String.format("清理练习主题%d个，单词练习结果%d个",clearData,integer);
    }
}
